<%@page import="com.company.entity.Projects"%>
<%@page import="com.company.entity.Chanpinfuwu"%>
<%@page import="java.util.List"%>
<%@ page language="java" contentType="text/html;charset=UTF-8"%>




<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
	<title>页面管理</title>
	<link rel="stylesheet" type="text/css"
		href="/back/index_data/xiugai_data/css.css">
		<link rel="stylesheet" type="text/css"
			href="/back/index_data/xiugai_data/manhuaDate.css">
			<script type="text/javascript"
				src="/back/index_data/xiugai_data/jquery.js"></script>
			<script type="text/javascript"
				src="/back/index_data/xiugai_data/manhuaDate.js"></script>
			<script type="text/javascript"
				src="/back/index_data/xiugai_data/jquery-1.js"></script>
			<!-- <script type="text/javascript" src="js/page.js" ></script> -->
			<script type="text/javascript">
				//下面用于图片上传预览功能
				function setImagePreview(avalue) {
					var docObj = document.getElementById("doc");
			
					var imgObjPreview = document.getElementById("preview");
					if (docObj.files && docObj.files[0]) {
						//火狐下，直接设img属性
						imgObjPreview.style.display = 'block';
						imgObjPreview.style.width = '300';
						imgObjPreview.style.height = '130';
						//imgObjPreview.src = docObj.files[0].getAsDataURL();
			
						//火狐7以上版本不能用上面的getAsDataURL()方式获取，需要一下方式
						imgObjPreview.src = window.URL.createObjectURL(docObj.files[0]);
					} else {
						//IE下，使用滤镜
						docObj.select();
						var imgSrc = document.selection.createRange().text;
						var localImagId = document.getElementById("img");
						//必须设置初始大小
						localImagId.style.width = "300";
						localImagId.style.height = "100";
						//图片异常的捕捉，防止用户修改后缀来伪造图片
						try {
							localImagId.style.filter = "progid:DXImageTransform.Microsoft.AlphaImageLoader(sizingMethod=scale)";
							localImagId.filters.item("DXImageTransform.Microsoft.AlphaImageLoader").src = imgSrc;
						} catch (e) {
							alert("您上传的图片格式不正确，请重新选择!");
							return false;
						}
						imgObjPreview.style.display = 'none';
						document.selection.empty();
					}
					return true;
				}
			</script>
</head>

<body>
	<div id="pageAll">
		<div class="pageTop">
			<div class="page">
				<img src="/back/index_data/xiugai_data/coin02.png"><span><a
						href="#">首页</a>&nbsp;-&nbsp;<a href="#">服务范围</a>&nbsp;-</span>&nbsp;产品服务





				
			</div>
		</div>

		<div class="page">
			<!-- vip页面样式 -->
			<div class="vip">
				<div class="xiu" style="display:inline;">
					<form action="/projects_save.action" method="post"
						enctype="multipart/form-data">
						<input type="hidden" name="p_id"> 工程名称： <input type="text"
							name="projects.title" /> 工程介绍： <textarea type="text"
								name="projects.content"></textarea><br>图片：<input
								type="file" name="upload1" value="上传图片1" /> <input type="file"
								name="upload2" value="上传图片2" /> <input type="file"
								name="upload3" value="上传图片3" /> <input type="file"
								name="upload4" value="上传图片4" />
								<button type="submit">添加数据</button>
					</form>
				</div>
				<!-- vip 表格 显示 -->
				<div class="conShow">
					<table border="1" cellpadding="0" cellspacing="0">
						<tbody>
							<tr>
								<td class="tdColor" width="250px">图片1</td>
								<td class="tdColor" width="250px">图片2</td>
								<td class="tdColor" width="250px">图片3</td>
								<td class="tdColor" width="250px">图片4</td>
								<td class="tdColor" width="66px">工程名称</td>
								<td class="tdColor" width="66px">工程介绍</td>
								<td class="tdColor" width="130px">操作</td>
							</tr>
							<%
								List<Projects> list = (List<Projects>) session.getAttribute("list");
								for (int i = 0; i < list.size(); ++i) {
									Projects projects = list.get(i);
									out.println("  <form name='form" + projects.getId()
											+ "' action='/projects_update.action'  method='post'  enctype='multipart/form-data'>   <tr>   <input type='hidden' name='projects.id' value='"
											+ projects.getId() + "' /> <td>   <div class='onsImg'>  <img src='/images/"
											+ projects.getImage1()
											+ "' id='preview'>    <input type='file' name='upload1' value='上传' id='doc' onchange='javascript:setImagePreview();' /></div>  </td>  <td>   <div class='onsImg'>  <img src='/images/"
											+ projects.getImage2()
											+ "' id='preview'>    <input type='file' name='upload2' value='上传' id='doc' onchange='javascript:setImagePreview();' /></div>  </td>  <td>   <div class='onsImg'>  <img src='/images/"
											+ projects.getImage3()
											+ "' id='preview'>    <input type='file' name='upload3' value='上传' id='doc' onchange='javascript:setImagePreview();' /></div>  </td>   <td>   <div class='onsImg'>  <img src='/images/"
											+ projects.getImage4()
											+ "' id='preview'>    <input type='file' name='upload4' value='上传' id='doc' onchange='javascript:setImagePreview();' /></div>  </td>      <td>    <input type='text' name='projects.title' value='"
											+ projects.getTitle()
											+ "' />       </td>    <td>    <input type='text' name='projects.content' value='"
											+ projects.getContent()
											+ "' />       </td>    </td>   <td><button class='btn' type='submit'  onclick='return confirm(\"确实要修改该条信息吗？\")'><img class='operation' src='/back/index_data/xiugai_data/update.png'></button>   <a onclick='return confirm(\"你确定要删除此条记录吗？\")' href='/projects_delete.action?projects.id="
											+ projects.getId()
											+ "'>  <img class='operation delban' src='/back/index_data/xiugai_data/delete.png'></button>   </a> </td>  </tr></form>");
								}
							%>
						</tbody>
					</table>

				</div>
				<!-- vip 表格 显示 end-->
			</div>
			<!-- vip页面样式end -->
		</div>
	</div>
	<script type="text/javascript">
		// 广告弹出框
		$(".delban").click(function() {
			$(".banDel").show();
		});
		$(".close").click(function() {
			$(".banDel").hide();
		});
		$(".no").click(function() {
			$(".banDel").hide();
		});
		// 广告弹出框 end
	</script>
</body>
</html>